package com.hns.phone.pushMsg.service;

import static java.util.concurrent.TimeUnit.SECONDS;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;

import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

public class BeeperControl {
	private final ScheduledExecutorService scheduler = Executors
			.newScheduledThreadPool(1);

	private ThreadPoolTaskExecutor taskExecutor;
	
	public void beepForAnHour() {
		final Runnable beeper = new Runnable() {
			public void run() {
				System.out.println("beep");
			}
		};
		final ScheduledFuture<?> beeperHandle = scheduler.scheduleAtFixedRate(
				beeper, 10, 10, SECONDS);
		scheduler.schedule(new Runnable() {
			public void run() {
				beeperHandle.cancel(true);
			}
		}, 60 * 60, SECONDS);
		
//		taskExecutor.execute(task, startTimeout);
//		taskExecutor.
		
	}
	
//	public void UpgradeProcessor(TaskExecutor taskExecutor) {
//        this.taskExecutor = taskExecutor;
//    }
	
}
